package org.buildworld.circuit

/**
 * 
 * 
 * @author Hans Haggstrom
 */

class Circuit {

  def addComponent( component : Component ) {
    components = component :: components
  }


  var components : List[Component] = Nil
  var connections : List[Connection] = Nil

  var time = 0L


  def loopSimulation(timeStep : int) {
    time = 0L
    while(true) {
      simulateStep(timeStep)
      time += timeStep
    }

  }

  def simulateStep( timeStep_ms : int) {
    connections foreach { c : Connection => c.update( timeStep_ms )}
    components foreach { c : Component => c.update( timeStep_ms )}
  }



}
